JSGF.SpriteBase = JSGF.inherit(JSGF.Object);

JSGF.SpriteBase.prototype.init = function(obj, width, height) {
	this.__check__ = "JSGF.Sprite";
	this.type = "JSGF.SpriteBase";
	this.x = 0;
	this.y = 0;
	this.zIndex = 0;
	this.visible = true;
	this.width = null;
	this.height = null;
	this.alpha = 1.0;
	if (width != null) {
		this.width = width;
	}
	if (height != null) {
		this.height = height;
	}
	this.additional(obj, width, height);
}

JSGF.SpriteBase.prototype.additional = function(obj) {

}

JSGF.SpriteBase.prototype.draw = function(context) {

}

////////////////////////////////////////
//Public
////////////////////////////////////////

JSGF.SpriteBase.prototype.setWidth = function(width) {
	this.width = width;
}

JSGF.SpriteBase.prototype.setHeight = function(height) {
	this.height = height;
}

JSGF.SpriteBase.prototype.getWidth = function() {
	return this.width;
}

JSGF.SpriteBase.prototype.getHeight = function() {
	return this.height;
}

JSGF.SpriteBase.prototype.getX = function() {
	return this.x;
}

JSGF.SpriteBase.prototype.getY = function() {
	return this.y;
}

JSGF.SpriteBase.prototype.setZIndex = function(zindex) {
	this.zIndex = zindex;
}

JSGF.SpriteBase.prototype.getZIndex = function() {
	return this.zIndex;
}

JSGF.SpriteBase.prototype.setAlpha = function(alpha) {
	this.alpha = alpha;
}

JSGF.SpriteBase.prototype.getAlpha = function() {
	return this.alpha;
}

JSGF.SpriteBase.prototype.setVisible = function(visible) {
	this.visible = visible;
}

JSGF.SpriteBase.prototype.getVisible = function() {
	return this.visible;
}

JSGF.SpriteBase.prototype.move = function(x, y) {
	this.x = x;
	this.y = y;
}

JSGF.SpriteBase.prototype.within = function(x, y) {
	if (x >= this.x && x <= this.x + this.width && y >= this.y && y <= this.y + this.height) {
		return true;
	} else {
		return false;
	}
}

JSGF.SpriteBase.prototype.isConflict = function(s){
	if(
		(this.getX() <= s.getX()+s.getWidth() && this.getX()+this.getWidth() >= s.getX())
		&&
		(this.getY() <= s.getY()+s.getHeight() && this.getY()+this.getHeight() >= s.getY())
	){
		return true;
	}else{
		return false;
	}
}


////////////////////////////////////////
// definition by user
////////////////////////////////////////

JSGF.SpriteBase.prototype.onClick = function(sprite, x, y) {

}

JSGF.SpriteBase.prototype.onDblClick = function(sprite, x, y) {

}

JSGF.SpriteBase.prototype.onMouseMove = function(sprite, x, y) {

}

JSGF.SpriteBase.prototype.onMouseDown = function(sprite, x, y) {

}

JSGF.SpriteBase.prototype.onMouseUp = function(sprite, x, y) {

}

